package com.smartfast4j.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 通用的页面视图跳转控制器
 * Created by gacl on 2017/11/22.
 */
@Controller
@RequestMapping("/view")
public class ViewController {

    /**
     * 跳转到指定视图页面
     * @param pageName 视图名称
     * @return
     */
    @RequestMapping(value = "/{pageName}")
    public String showPage(@PathVariable("pageName") String pageName) {
        return pageName;
    }

    /**
     * 跳转到指定模块的视图页面
     * @param module 模块名
     * @param pageName 视图名称
     * @return
     */
    @RequestMapping(value = "/{module}/{pageName}")
    public String showPage(@PathVariable("module") String module, @PathVariable("pageName") String pageName) {
        return module+"/" + pageName;
    }
}
